/* Copyright (c) Byron Adams <byron.adams54@gmail.com>
   See the file LICENSE for licensing information. */


//POST /translate_txt ei=UTF-8&doit=done&fr=bf-res&intl=1&tt=urltext&trtext=Albert+Johnson+III+%28born+November+11%2C+1977+in+Houston%2C+Texas%29+is+a+Canadian+Football+League+player+for+the+Winnipeg+Blue+Bombers.+Johnson+played+his+college+football+for+Southern+Methodist+University+and+then+signed+with+the+Saskatchewan+Roughriders+where+he+played+three+games+in+1999.+Johnson+then+signed+with+the+Blue+Bombers+and+went+on+to+win+the+league%27s+Rookie+of+the+Year+Award+in+2000+after+leading+the+league+in+return+yardage.+He+signed+with+the+Miami+Dolphins+in+2001+and+later+played+with+the+New+York+Jets+and+Houston+Texans+but+suffered+injuries+throughout+his+National+Football+League+stint.+In+2006+Johnson+returned+to+the+Blue+Bombers+and+once+again+lead+the+CFL+in+return+yardage+and+was+second+in+combined+yards+to+fellow+team-mate+Charles+Roberts.&lp=en_fr&btnTrTxt=Translate



translator.service({
  meta : {
    version : "0.0.1",
    shortName : "systran",
    name : "Systran Global Translation.",
    icon : "chrome://translator/skin/services/systran.png",
    homepage : "http://www.systran.co.uk/"
  },
  
  translate : {
    charLimit : 1000,
    method : function (options) {
      
      Mozkit.http.send({
        method : "POST",
        url : "http://babelfish.yahoo.com/translate_txt",
        requestBody : {
          btnTrTxt : "Translate",
          fr : "bf-res",
          intl : 1,
          tt : "urltext",
          ei : "UTF-8",
          doit : "done",
          lp : options.srcLang + "_" + options.destLang,
          trtext : options.text
        },
        callBack : function (data) {
            console.log(data.split(" <div id=\"result\"><div style=\"padding: 0.6em;\">")[1].split("</div>")[0]);
        },
        error : function (error) {
          console.log(error);
          options.fail(error);
        }
      });
    }
  },
  
  langSets : {
    ENGLISH : ["FRENCH", "SPANISH", "ITALIAN", "PORTUGUESE", "GERMAN", "DUTCH", "SWEDISH", "RUSSIAN", "ARABIC", "JAPANESE", "KOREAN", "CHINESE", "POLISH", "GREEK"], FRENCH:["ENGLISH", "SPANISH", "ITALIAN", "PORTUGUESE", "GERMAN", "DUTCH", "GREEK"],
    SPANISH:["ENGLISH", "FRENCH", "ITALIAN", "PORTUGUESE", "GERMAN"],
    ITALIAN:["ENGLISH", "FRENCH", "SPANISH", "PORTUGUESE", "GERMAN"],
    PORTUGUESE:["ENGLISH", "FRENCH", "SPANISH", "ITALIAN", "GERMAN"],
    GERMAN:["ENGLISH", "FRENCH", "SPANISH", "ITALIAN", "PORTUGUESE"],
    DUTCH:["ENGLISH", "FRENCH"],
    SWEDISH:["ENGLISH"],
    RUSSIAN:["ENGLISH"],
    ARABIC:["ENGLISH"],
    JAPANESE:["ENGLISH"],
    KOREAN:["ENGLISH"],
    CHINESE:["ENGLISH"],
    POLISH:["ENGLISH"],
    GREEK:["ENGLISH", "FRENCH"]}
});